#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>

int main()
{
    int fd1 = open("bite",O_WRONLY | O_CREAT| O_TRUNC,0666);
    if(fd1 < 0)
    {
        perror("open");
        return -1;
    }
    char buffer[] = {"Linux so easy!"};
    int n = write(fd1,buffer,sizeof(buffer)-1);
    if (n<0)
    {
        perror("write");
        return -1;
    }
    close(fd1);
    int fd2 =  open("bite",O_RDONLY);
    char rdbuffer[50] = {0};
    int m = read(fd2,rdbuffer,sizeof(rdbuffer));
    while (m)
    {
       write(1,rdbuffer,m);
       m = read(fd2,rdbuffer,sizeof(rdbuffer));
    }
    printf("\n");
    close(fd2);
    return 0;
}